#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2024/11/12 8:44
# @Author  : cfg
# @File    : main_ui.py
# @Software: PyCharm
import tkinter
import tkinter.ttk as ttk

from ui.install_multi_ui import InstallMultiUI
from ui.install_single_ui import InstallSingleUI
from utils.path_utils import root_path


class MainUI:
    def __init__(self):
        self.window = tkinter.Tk()
        self.window.iconphoto(False, tkinter.PhotoImage(file=root_path + 'imgs/mimetypes_jar_362.png'))
        self.window.resizable(False, False)

        screen_width = self.window.winfo_screenwidth()
        screen_height = self.window.winfo_screenheight()
        self.window_width = 620
        self.window_height = 500
        self.window_x = (screen_width - self.window_width) / 2
        self.window_y = (screen_height - self.window_height) / 2
        self.window.title("JarInstaller")
        self.window.geometry("%dx%d+%d+%d" % (self.window_width, self.window_height, self.window_x, self.window_y - 100))

        self.notebook = tkinter.ttk.Notebook(self.window)
        frame_single = InstallSingleUI(self.window)
        frame_multi = InstallMultiUI(self.window)
        self.notebook.add(frame_single, text='单个安装')
        self.notebook.add(frame_multi, text='批量安装')
        self.notebook.pack(padx=10, pady=5, fill=tkinter.BOTH, expand=True)

    def mainloop(self):
        self.window.mainloop()